import time

from selenium.webdriver.chrome import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from pages.basePage import BasePage

# driver = webdriver.WebDriver()
# driver.get('http://192.168.109.131/user.php')
# driver.maximize_window()
class Login(BasePage):
    # 三个属性
    euname = (By.NAME,'username')
    pwd = (By.NAME,'password')
    anbut = (By.NAME,'submit')
    # 行为


    def denglu(self,name='鹿鸣',mima='huo101069'):
        # 输入用户名
        # self.driver.find_element(*self.euname).send_keys(name)
        # self.findEle(self.euname).send_keys(name)
        # time.sleep(2)
        self.inpuText(self.findEle(self.euname),name)
        # 输入密码
        # self.driver.find_element(*self.pwd).send_keys(mima)
        self.inpuText( self.findEle(self.pwd),mima)
        # time.sleep(2)
        # 点击登录
        # self.driver.find_element(*self.anbut).click()
        # self.findEle(self.anbut).click()
        self.eleClick(self.findEle(self.anbut))
        time.sleep(2)


    #成功,获取成功后的结果
    def loginOk(self):
        t = self.getEleTxt(self.findEle(self.eloginOrUname))
        return t
    # 参数有空时,获取失败后的结果
    def loginErrorNone(self):
        return self.getAlertTxt()
    # 获取失败后的结果
    def loginError(self):
        t = self.getEleTxt(self.findEle(self.eloginOrUname))
        return t


if __name__ == '__main__':
    from pages.ecShopdenglu import Login

    lp = Login()
    lp.login("鹿鸣", "")
    # lp = Login()
    # lp.denglu('','')













